<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>06-第六题</title>
</head>
<body>
<script>
    var arr = [23, 3, 5, 7, 243, 1, 25, 48]
    var my_len = arr.length

    function min(arr) {
        // for (var i in arr) {
        for (var i = 0; i <= my_len; i++) {
            var num1 = arr[i]
            var num2 = arr[i + 1]
            if (num1 > num2) {  // 23  3
                arr[i] = num2  // 3 3
            }
            else {
                arr[i + 1] = num1
            }
        }
        document.write(arr[my_len -1])  // 1
        document.write(arr)  // 3,3,3,3,1,1,1,1,1,1
    }
    min(arr)
</script>
</body>
</html>